package com.jqr.activity.listviewdemo.ui;

import androidx.appcompat.app.AppCompatActivity;

import android.os.Bundle;
import android.util.Log;
import android.widget.ListView;

import com.jqr.activity.listviewdemo.R;
import com.jqr.activity.listviewdemo.adapters.MyAdapter;
import com.jqr.activity.listviewdemo.model.Article;

import java.util.ArrayList;
import java.util.List;

public class BaseAdapterActivity extends AppCompatActivity {
    private ListView listView;
    private List<Article> articleList;
    private MyAdapter myAdapter;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_base_adapter);
        initData();
        initView();
    }
    private void initView(){
        listView=findViewById(R.id.sAdapterListView);
        Log.d("TAG",String.valueOf(articleList.size()));
        myAdapter=new MyAdapter(this,articleList);
        listView.setAdapter(myAdapter);
    }
    private  void initData(){
        articleList=new ArrayList<>();

        articleList.add(new Article(1,"多丽雅","朵莉亚在水域(河道也视为水域)会化为人鱼形态，减少50%所受的减速效果，并且每秒回复70点生命和5点法力。人鱼形态的普攻会射出水箭，造成范围伤害。",R.drawable.a));

        articleList.add(new Article(2,"大司命","大司命的普攻会振动戈产生戈鸣，戈鸣与敌人灵魂连接，持续3秒。魂链每次造成50%物理攻击伤害，敌人若不挣脱魂链，则魂链的伤害频率会越来越高，结束时还会再造成70~140(+80%物理攻击)法术伤害。",R.drawable.b));

        articleList.add(new Article(3,"海诺","海诺根据命运指引，使用远程和近战两种状态战斗。海诺的技能和近战普攻命中敌人会对其叠加印记，持续7秒。\n" +
                "远程：海诺凝集命运之力对远处的敌人攻击，造成100%物理攻击的物理伤害和15%法术攻击的法术伤害。",R.drawable.d));
        articleList.add(new Article(4,"敖隐","敖隐挥出剑气，自身立即增加30/40/50/60%随时间衰减的移速，并对范围内至多3个目标造成240/320/400/480(+35%额外物理攻击)物理伤害(对目标身后造成50%溅射效果)和击退效果。",R.drawable.c));
    }


}